<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
</head>
<body>
<script type="text/javascript">
        var newsExpires = localStorage.getItem('news_expires');
        newsExpires = !!newsExpires ? parseInt(newsExpires) : null;
        var browserVer = localStorage.getItem('browser_ver');
        var nowTime = (new Date()).getTime();
        var head = document.querySelector('head');
        var body = document.querySelector('body');
        var halfDay = 43200000;
        var localLoadin = JSON.parse(localStorage.getItem('cache_news_loadin'));
        function getPar(param) {
            var str = '';
            var reg = new RegExp("(^|&)"+ param +"=([^&]*)(&|$)");
            var r = card.vurl().split('?')[1].match(reg);
            if(r != null) {
                str = unescape(r[2]);
            }
            return str;
        }
        function getById(id) {
            return document.getElementById(id);
        }
        function cN(tag, data, parTag, id) {
            var node = document.createElement(tag);
            node.setAttribute('id', id);
            node.innerHTML = data;
            parTag.appendChild(node);
        }
        function cP(obj) {
            cN('style', obj.css, head, 'GYSty');
            cN('script', obj.zepto, head, 'GYZep');
            cN('div', obj.frame, body, 'GYDiv');
            cN('script', obj.js, body, 'GYJs');
        }
        function run(data) {
            console.log(data);
            if (getById('GYDiv')) return;
            localStorage.setItem('cache_news_loadin', JSON.stringify(data));
            localStorage.setItem('news_expires', (new Date()).getTime());
            localStorage.setItem('browser_ver', getPar('ver'));
            localLoadin = JSON.parse(localStorage.getItem('cache_news_loadin'));
            cP(data);
        }
        if (getPar('ver') != browserVer) {newsExpires = null;}
        if (newsExpires && (nowTime - newsExpires) < halfDay) {
            cP(localLoadin);
        } else {
            setTimeout(function() {
                if (getById('GYDiv')) {
                    return;
                } else {
                    cP(localLoadin);
                }
            }, 10000);
            var rS = document.createElement('script');
            rS.src = window.card.vurl().split('?')[0];
            body.appendChild(rS);
        }
    </script>
</body>
</html>